import cheerio from 'cheerio'
import { generateImgUrl } from '@/utils'

export default function (richTest) {
  const $ = cheerio.load(richTest)
  $('img').css('max-width', '100%')
  $('img').each((index, elm) => {
    const src = $(elm).attr('src')
    $(elm).attr('src', generateImgUrl(src))
  })
  return $('body').html()
}
